
import 'package:flutter/material.dart';

import '../../entity/home/video_list_entity.dart';
import '../../entity/profile/own_video_list_entity.dart';
import '../../entity/recommend/VideoCircleEntity.dart';
import '../../network/base_entity.dart';
import '../../network/http_config.dart';
import '../../network/http_entity.dart';
import '../../network/http_manager.dart';
import '../../other/user_manager.dart';
import '../../ui/widget/custom_refresh_mixin.dart';

class VideoCircleModel extends ChangeNotifier  with CustomRefreshMixin {
  List<String> tabs = ["热门","最新","最早"];
  TabController? tabController;
  int currentIndex = 0;
  VideoCircleModel() {
  }

  @override
  Future<List> requestList(int page) async {
    List tempL = [];
    Map<String, dynamic> params = {};
    params["pageSize"] = 10;
    params["pageNum"] = page;
    // String id = UserManager.userEntity!.userInfo!.id!;

    params["userId"] =  int.parse("1");;

    HttpEntity? result = await HttpManager.getInstance().request(url: "/video/videoCircle/list", params: params,method: Method.post) as HttpEntity;
    if (result?.isSuccess() == true) {
      VideoCircleEntityList listResult = VideoCircleEntityList.fromJson(result.getOriData()["rows"],result);
      List<VideoCircleEntity>? temps = listResult.videoCircleEntityList;
      if (temps != null) {
        tempL.addAll(temps);
      }
      hasNext = listResult.hasNext ?? false;
    } else {
    }
    return tempL;
  }


  @override
  void onRequestComplete() {
    notifyListeners();
  }

  @override
  Future<List> requestListByParam(int page, Map<String, dynamic> param) {
    // TODO: implement requestListByParam
    throw UnimplementedError();
  }
}